home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / comm / dcddv24.lha / DCDDtime.rexx < prev    next >
OS/2 REXX Batch file  |  1995-08-18  |  5KB  |  217 lines

  1. /*
  2.  
  3. DCDDtime.rexx Version 1.3e                                 950818.2152
  4.  
  5. 940725 - changed PNET NewBillDay from 06 to 01 and NewBillAdj to 'NONE'
  6. 950818 - added 1 digit to hours to show 3 digits. (darn internet!!!)
  7.  
  8. */
  9.  
  10. address command
  11.  
  12. OPTIONS RESULTS
  13.  
  14. windev = "CON:150/50/380/110/DCDDtime "
  15.  
  16. if ~open('wind',windev) then exit      /* Window for all activity */
  17.  
  18. call J_DATE
  19.  
  20. call wsay(' ')
  21.  
  22. /* TotalBy = 'CRIS' */
  23. TotalBy = 'PNET'
  24. call GetToday
  25. call GetTimeTitle
  26. call GetTotTime
  27.  
  28. X_temp= '   ONLINE CONNECT TIME FOR SERVICES BELOW ' 
  29.  
  30. call wsay(X_temp)
  31. call wsay(' ')
  32.  
  33. X_temp= '     ' right(thours,3,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')  ' - 'TotalBy'  - '      NewBillDay  date('m',dateYYYYMMDDx,'s')
  34. call wsay(X_temp)
  35.  
  36. TotalBy = 'LONGD'
  37. call GetToday
  38. call GetTimeTitle
  39. call GetTotTime
  40. X_temp= '     ' right(thours,3,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')  ' - 'TotalBy' - '      NewBillDay  date('m',dateYYYYMMDDx,'s')
  41. call wsay(X_temp)
  42.  
  43. TotalBy = 'LOCAL'
  44. call GetToday
  45. call GetTimeTitle
  46. call GetTotTime
  47. X_temp= '     ' right(thours,3,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')  ' - 'TotalBy' - '      NewBillDay  date('m',dateYYYYMMDDx,'s')
  48. call wsay(X_temp)
  49.  
  50. J_temp= '     the Amiga Era is now 'Jdate' days old'  
  51. call wsay(' ')
  52. call wsay(J_temp)
  53. call wsay(' ')
  54. call wsay('         Press Return to continue')
  55. LetMeGo = readln('wind')
  56.  
  57. exit
  58.  
  59. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  60.  *                                                             *
  61.  *                   Functions / Subroutines                   *
  62.  *                                                             *
  63.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  64.  
  65.          /* Function - put string to window with EOL */
  66. wsay:
  67. parse arg strx
  68. call writeln('wind',strx)
  69. return
  70.  
  71.          /* Function - put string to window without EOL */
  72. wsaych:
  73. parse arg strx
  74. call writech('wind',strx)
  75. return
  76.  
  77.  
  78. GetToday:
  79.  
  80.   dateYYYY=left(date(sorted),4)               
  81.   dateYYYYMM=left(date(sorted),6)               
  82.   dateMM=right(dateYYYYMM,2)              
  83.   dateYYMMDD=right(date(sorted),6)              
  84.   dateDD=right(dateYYMMDD,2)              
  85. return
  86.  
  87.  
  88. GetTotTime:
  89.  
  90. /* gets total time for the month */
  91.  
  92.   if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
  93.     thours = 0
  94.     tmins = 0                     /* If file doesn't exist, set to zero */
  95.     tsecs = 0
  96.   end
  97.  
  98.   else do
  99.     thours=readln('TotTime')      /* If file does exist, read them */
  100.     tmins=readln('TotTime')
  101.     tsecs=readln('TotTime')
  102.     call close('TotTime')
  103.   end
  104. return
  105.  
  106.  
  107. GetTimeTitle:
  108.  
  109.  
  110. /*
  111.  
  112.    Internet access has been added to DCDD and this has forced me to keep
  113.    monthly time totals for different SERVICES. I am using CRIS for my
  114.    Internet connection, LONGD for my long distance direct dialing, and
  115.    LOCAL for my local BBSes. The totals are controled the same as befor
  116.    by using NewBillDay and NewBillAdj. 
  117.  
  118.    If for instance NewBillDay = 8, and NewBillAdj = MINUS then the monthly
  119.    hours/minutes/seconds total will run from the 8th of one month till the
  120.    7th of the next month to match the way your phone company bills you.
  121.  
  122.    NewBillAdj is used to either put the first few days of this month into
  123.    last months totals (MINUS) or the last few days of this month into next
  124.    month (PLUS). (sort of crazy but it works!) 
  125.  
  126. */
  127.  
  128.  
  129. /* * * * * *  **************************************************  * * * * * */
  130. /* *********     BE SURE TO PUT THE DATA BELOW INTO DCDD.rexx     ********* */
  131. /* * * * * *  **************************************************  * * * * * */
  132.  
  133.   if TotalBy = ' ' then do
  134.      TotalBy = 'LONGD'
  135.      NewBillDay = 08
  136.      NewBillAdj = 'MINUS'
  137.   end 
  138.  
  139.   if TotalBy = 'LONGD' then do
  140.      NewBillDay = 08
  141.      NewBillAdj = 'MINUS'
  142.   end 
  143.  
  144. /*
  145.   if TotalBy = 'CRIS' then do
  146.      NewBillDay = 13
  147.      NewBillAdj = 'MINUS'
  148.   end 
  149. */
  150.  
  151.   if TotalBy = 'CRIS' then do
  152.      NewBillDay = 01
  153.      NewBillAdj = 'NONE'
  154.   end 
  155.  
  156.   if TotalBy = 'PNET' then do
  157.      NewBillDay = 01
  158.      NewBillAdj = 'NONE'
  159.   end 
  160.  
  161.   if TotalBy = 'LOCAL' then do
  162.      NewBillDay = 01
  163.      NewBillAdj = 'NONE'
  164.   end 
  165.  
  166. /* * * * * *  **************************************************  * * * * * */
  167. /* *********     BE SURE TO PUT THE DATA ABOVE INTO DCDD.rexx     ********* */
  168. /* * * * * *  **************************************************  * * * * * */
  169.  
  170.   dateMMx = dateMM
  171.   dateYYYYx = dateYYYY
  172.  
  173.   if NewBillAdj = "MINUS" then do
  174.      if dateDD < NewBillDay then do
  175.         if dateMM = 01 then do
  176.            dateMMx = 12
  177.            dateYYYYx = dateYYYY - 1
  178.            end
  179.         else do
  180.            dateMMx = dateMM - 1
  181.            if dateMMx < 10 then 
  182.               dateMMx = 0||dateMMx
  183.            end
  184.      end
  185.   end
  186.  
  187.   if NewBillAdj = "PLUS" then do
  188.      if dateDD ~ < NewBillDay then do
  189.         if dateMM = 12 then do
  190.            dateMMx = 01
  191.            dateYYYYx = dateYYYY + 1
  192.            end
  193.         else do
  194.            dateMMx = dateMM + 1
  195.            if dateMMx < 10 then
  196.               dateMMx = 0||dateMMx
  197.            end
  198.      end
  199.   end
  200.   timetitle='dh0:DemonDialer/DCDDtime_'totalby||'_'||dateYYYYx||dateMMx
  201.   dateYYYYMMDDx = dateYYYYx||dateMMx||dateDD 
  202.  
  203.   if NewBillAdj = "NONE" then do
  204.      timetitle='dh0:DemonDialer/DCDDtime_'totalby||'_'||dateYYYYMM
  205.      dateYYYYMMDDx = dateYYYY||dateMM||dateDD 
  206.      end
  207.   
  208.   return
  209.  
  210.  
  211. J_DATE:
  212.  
  213. dateYYYYMMDD = left(date(sorted),8)
  214. JDATE = date('i',dateYYYYMMDD,'s')
  215.  
  216. return
  217.